import os
import ProtoManager
import Proto
# this code is to get format file and set it.

class protoFactory:
    def __init__(self):
        self.manager		= ProtoManager.protoManager()
        self.format_pairs	= []
        self.filter_pairs	= []

    def generate(self):
        file_object	= open("proto.ana")
        for line in file_object:
            pair	= line.split()
            if pair[0] == "#":
                protoItem	= Proto.proto()
                if len(pair) < 2 or self.manager.protos.has_key(pair[1]):
                    return False
                self.manager.protos[pair[1]]= protoItem;
            elif len(pair) == 2 and pair[0].isdigit():
                protoItem.format_pairs.append([ int(pair[0]) , pair[1] ])
                
        file_object.close()


a = protoFactory()
a.generate()
